let myTools = {
}

/**
 * @description 将两个数组合并
 * @param {*} arr1 数组1
 * @param {*} arr2 数组2
 */
myTools.unionArray = (arr1, arr2) => {
  let unionArr = JSON.parse(JSON.stringify(arr1))
  arr2.array.forEach(element => {
    unionArr.push(element)
  })
  return unionArr
}

/**
 * 将日期时间类型格式化为 yyyy-MM-dd hh:mm:ss
 * @param {*} timeStamp 时间戳
 */
myTools.dateFormat = (timeStamp) => {
  if (timeStamp) {
    let date = new Date(time)
    return date.format('yyyy-MM-dd')
  } else {
    return ''
  }
}

/**
 * 敏感操作确定按钮
 */
myTools.confirm = (that, content, okCallBack, cancelCallBack) => {
  that.$Modal.confirm({
    title: '确定操作',
    content: '确定' + content + '?',
    onOk: okCallBack,
    onCancel: cancelCallBack
  })
}

export default myTools
